

from PyQt5.QtCore import Qt

    # Enter shift+Enter Ctrl+F
    # 注意 e.modifiers() == Qt.NoModifier, 不加这一句的话会同时触发第1个分支和第2个分支
    def keyPressEvent(self, e):
        if (e.modifiers() == Qt.NoModifier) and (e.key() == Qt.Key_Return):
            self.signal_key.emit(Qt.Key_Return)
        elif (e.modifiers() == Qt.ShiftModifier) and (e.key() == Qt.Key_Return):
            self.signal_key.emit(Qt.Key_Return + Qt.ShiftModifier)
        elif (e.modifiers() == Qt.ControlModifier) and (e.key() == Qt.Key_F):
            self.ui.pushButtonClose.click()
 
    # Ctrl+1 Ctrl+2 Ctrl+`
    def keyPressEvent(self, e):
        if (e.modifiers() == Qt.ControlModifier) and (e.key() == Qt.Key_1):
            self.widgetui.plainTextEditRec.clear()
        if (e.modifiers() == Qt.ControlModifier) and (e.key() == Qt.Key_2):
            self.widgetui.plainTextEditSend.clear()
        if (e.modifiers() == Qt.ControlModifier) and (e.key() == Qt.Key_QuoteLeft):
            self.widgetui.plainTextEditRec.clear()
            self.widgetui.plainTextEditSend.clear()


    def keyPressEvent(self, e):
        """
        ctrl+alt+shift+F8
        :param e:
        :return:
        """
        if (e.modifiers() == Qt.ControlModifier | Qt.AltModifier | Qt.ShiftModifier) \
                and (e.key() == Qt.Key_F8):
            self.on_pushButtonCut_clicked()